﻿<UserControl x:Class="Kokomo.PeInspector.Reflection.AssemblyListSearchView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
			 xmlns:env="xaml://kokomo/environment"
			 xmlns:kui="xaml://kokomo/ui"
			 xmlns:pe="clr-namespace:Kokomo.PeInspector"
			 xmlns:r="clr-namespace:Kokomo.PeInspector.Reflection"
             d:DesignHeight="300" d:DesignWidth="300">
	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="*"/>
		</Grid.RowDefinitions>

		<Grid>
			<ProgressBar
				Maximum="{Binding SearchProgress.Maximum}"
				Value="{Binding SearchProgress.Progress, Mode=OneWay}"
				>
				<ProgressBar.Style>
					<Style TargetType="{x:Type ProgressBar}">
						<Setter Property="Visibility" Value="Hidden"/>
						<Style.Triggers>
							<DataTrigger Binding="{Binding IsSearching}" Value="True">
								<Setter Property="Visibility" Value="Visible"/>
							</DataTrigger>
						</Style.Triggers>
					</Style>
				</ProgressBar.Style>
			</ProgressBar>
			<AdornerDecorator>
				<TextBox
					Text="{Binding Path=SearchTerm, UpdateSourceTrigger=PropertyChanged}"
					Background="Transparent"
					kui:WatermarkService.WatermarkContent="Search"
					/>
			</AdornerDecorator>
		</Grid>

		<Expander
			Grid.Row="1"
			Header="Options"
			>
			<StackPanel>
				<CheckBox
					IsChecked="{Binding RequiresExactMatch}"
					Content="{x:Static pe:Messages.ExactMatchText}"
					/>
				<CheckBox
					IsChecked="{Binding IsCaseSensitive}"
					Content="{x:Static pe:Messages.CaseSensitiveText}"
					/>
				<GroupBox Header="{x:Static pe:Messages.VisibilityTitle}">
					<StackPanel>
						<CheckBox
							IsChecked="{Binding IncludeNonPublicTypes}"
							Content="{x:Static pe:Messages.IncludeNonPublicTypesText}"
							/>
						<CheckBox
							IsChecked="{Binding IncludeNonPublicMembers}"
							Content="{x:Static pe:Messages.IncludeNonPublicMembersText}"
							/>
						<CheckBox
							IsChecked="{Binding IncludeSpecialNames}"
							Content="{x:Static pe:Messages.IncludeSpecialNamesText}"
							/>
					</StackPanel>
				</GroupBox>
				<GroupBox Header="{x:Static pe:Messages.MemberTypeTitle}">
					<StackPanel>
						<StackPanel.Resources>
							<Style TargetType="{x:Type Image}">
								<Setter Property="Stretch" Value="Uniform"/>
								<Setter Property="StretchDirection" Value="DownOnly"/>
								<Setter Property="VerticalAlignment" Value="Center"/>
								<Setter Property="HorizontalAlignment" Value="Left"/>
							</Style>
						</StackPanel.Resources>
						<CheckBox
							IsChecked="{Binding IncludeTypes}"
							>
							<TextBlock>
								<Image Source="{env:Image {x:Static r:MetadataIconKeys.Class}, {x:Static r:AssemblyAnalyzerEditor.MetadataIconProvider}}"/>
								<Run Text="{x:Static pe:Messages.TypesText}" BaselineAlignment="Center"/>
							</TextBlock>
						</CheckBox>
						<CheckBox
							IsChecked="{Binding IncludeFields}"
							>
							<TextBlock>
								<Image Source="{env:Image {x:Static r:MetadataIconKeys.Field}, {x:Static r:AssemblyAnalyzerEditor.MetadataIconProvider}}"/>
								<Run Text="{x:Static pe:Messages.FieldsText}"/>
							</TextBlock>
						</CheckBox>
						<CheckBox
							IsChecked="{Binding IncludeMethods}"
							>
							<TextBlock>
								<Image Source="{env:Image {x:Static r:MetadataIconKeys.Method}, {x:Static r:AssemblyAnalyzerEditor.MetadataIconProvider}}"/>
								<Run Text="{x:Static pe:Messages.MethodsText}" BaselineAlignment="Center"/>
							</TextBlock>
						</CheckBox>
						<CheckBox
							IsChecked="{Binding IncludeProperties}"
							>
							<TextBlock>
								<Image Source="{env:Image {x:Static r:MetadataIconKeys.Property}, {x:Static r:AssemblyAnalyzerEditor.MetadataIconProvider}}"/>
								<Run Text="{x:Static pe:Messages.PropertiesText}" BaselineAlignment="Center"/>
							</TextBlock>
						</CheckBox>
						<CheckBox
							IsChecked="{Binding IncludeEvents}"
							>
							<TextBlock>
								<Image Source="{env:Image {x:Static r:MetadataIconKeys.Event}, {x:Static r:AssemblyAnalyzerEditor.MetadataIconProvider}}"/>
								<Run Text="{x:Static pe:Messages.EventsText}" BaselineAlignment="Center"/>
							</TextBlock>
						</CheckBox>
					</StackPanel>
				</GroupBox>
			</StackPanel>
		</Expander>
		<ListView
			Grid.Row="2"
			ItemsSource="{Binding Results}"
			TextSearch.TextPath="MemberName"
			kui:ListViewHelper.IsSortingEnabled="True"
			kui:ListViewHelper.ItemActivatedCommand="{Binding NavigateToCommand}"
			>
			<ListView.ItemContainerStyle>
				<Style>
					<Setter Property="kui:ListViewHelper.ItemParameter" Value="{Binding Member}"/>
				</Style>
			</ListView.ItemContainerStyle>
			<ListView.View>
				<GridView>
					<GridViewColumn Header="{x:Static pe:Messages.MemberTitle}" kui:ListViewHelper.SortPropertyName="MemberName">
						<GridViewColumn.CellTemplate>
							<DataTemplate>
								<ContentPresenter Content="{Binding ViewInfo}"/>
							</DataTemplate>
						</GridViewColumn.CellTemplate>
					</GridViewColumn>
					<GridViewColumn Header="{x:Static pe:Messages.TypeTitle}" kui:ListViewHelper.SortPropertyName="TypeName" Width="100">
						<GridViewColumn.CellTemplate>
							<DataTemplate>
								<ContentPresenter Content="{Binding TypeViewInfo}"/>
							</DataTemplate>
						</GridViewColumn.CellTemplate>
					</GridViewColumn>
					<GridViewColumn Header="{x:Static pe:Messages.AssemblyTitle}" DisplayMemberBinding="{Binding AssemblyName}" kui:ListViewHelper.SortPropertyName="AssemblyName"/>
				</GridView>
			</ListView.View>
		</ListView>
	</Grid>
</UserControl>
